export const useDrop = (dropDom: HTMLElement, {
    onShow,
    onHide,
    onDrop
}) => {
    const init = () => {
        const ele = dropDom;
        ele.addEventListener('dragenter', onShow); //拖后放
        ele.addEventListener('dragleave', onHide); //拖离
        ele.addEventListener('drop', onDrop); //拖进
    };
    const disableDefaultEvents = () => {
        const doc = document.documentElement;
        doc.addEventListener('dragleave', (e) => e.preventDefault()); //拖离
        doc.addEventListener('drop', (e) => e.preventDefault()); //拖后放
        doc.addEventListener('dragenter', (e) => e.preventDefault()); //拖进
        doc.addEventListener('dragover', (e) => e.preventDefault()); //拖来拖去
    };

    disableDefaultEvents();
    init();
};